﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BabyFood.Entities;
using BabyFood.Data;

public partial class Controls_ControlShowPic : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ltlConTent.Text = LoadData();
        }
    }

    private string LoadData()
    {
        string strHTML = "";
        int outRow = 0;
        string WhereClause = "TinNong=1";
        TList<TinTuc> TList_TinTuc = DataRepository.TinTucProvider.GetPaged(WhereClause, "Id DESC", 0, 12, out outRow);
        if (TList_TinTuc.Count > 0)
        {
            int i;
            //Phần liệt kê ảnh bên phải
            for(i=0; i<=TList_TinTuc.Count-1;i++)
            {
                strHTML += "<div data-thumb='" + "./Upload/AnhDaiDien/" + TList_TinTuc[i].AnhDaiDien + "'>";
                strHTML += "<img class=\"imgSty\" src='" + "./Upload/AnhDaiDien/" + TList_TinTuc[i].AnhDaiDien + "' alt=\"fmslideshow\" />";
                strHTML += "<div data-align=\"BL\" data-spacing=\"0,0\" data-inOutDirection=\"BB\" data-inOutDistance=\"170\" class=\"divStyle\" style=\"width:623px\" >";
 				strHTML += "<div id=\"bg\" style=\"background-color:#000\" class=\"textBg\"></div>";
                strHTML += "<div class=\"txtExNormal\" style=\"padding-bottom:6px; color:#fff; margin-right:75px\">";
                strHTML += "<span class=\"txtLarge\" style=\"color:#fff; margin-left:-10px\"><strong>" + TList_TinTuc[i].TieuDe + "</strong></span></br>";
                strHTML += "" + TList_TinTuc[i].TomTat + " <a href=" + "./tintuc/" + TList_TinTuc[i].Id + "_" + GetTieuDe(TList_TinTuc[i].TieuDe)+ ".aspx" + " target=\"_blank\"  style=\"color:#F90; font-weight:bold\">Click here</a>";
                strHTML += "</div></div>";
                strHTML += "</div>";
            }
        }
        return strHTML;
    }

    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }
    public string anhdaidien(object Char)
    {
        string s = Char.ToString();
        return ResolveUrl("../" + Common.StandardStringlink(s));

    }
}